using System;
using uTILLIty.Rave.Contract.StorageAdapter;
using uTILLIty.Rave.Core.Configuration;

namespace uTILLIty.Rave.Core.Strategy
{
  /// <summary>
  /// Implementors provide a strategy for building a new <see cref="Configuration"/>
  /// from an existing path
  /// </summary>
  public interface IConfigurationConstructorStrategy
  {
    /// <summary>
    /// Constructs a <see cref="Contract.Configuration.Configuration"/> from an existing directory
    /// </summary>
    /// <param name="root">The directory to start from</param>
    /// <param name="adapter">The <see cref="IStorageAdapter"/> to use for member-lookup</param>
    /// <param name="recursive">Wether to process just the <paramref name="root"/> directory, or also it's children</param>
    /// <param name="onAfterVisit">Optional action to call after visiting a directory and building it's configuration</param>
    /// <param name="onVisitError">Optional action to call when an error during visiting a directory occurs</param>
    /// <returns>The built <see cref="Contract.Configuration.Configuration"/></returns>
    Contract.Configuration.Configuration BuildFromDirectory(string root, IStorageAdapter adapter, bool recursive, 
                                                                            Action<ConfigurationExtensions.VisitingContext> onAfterVisit, Action<ConfigurationExtensions.VisitingError> onVisitError);
  }
}